package com.asiainfo.product.service.impl;

import com.asiainfo.entity.product.Product;
import com.asiainfo.product.service.ProductService;
import org.springframework.stereotype.Service;

import java.math.BigDecimal;
import java.util.concurrent.TimeUnit;

@Service
public class ImplProductService implements ProductService {

    /**
     * 返回商品信息
     * @param productId
     * @return
     */
    @Override
    public Product getProductById(Long productId) {

       /* try {
            TimeUnit.SECONDS.sleep(100);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }*/
        //商品返回数据
        Product result = Product.builder()
                .id(productId)
                .num(2)
                .productName("小米14-Plus")
                .price(new BigDecimal("5499.49"))
                .build();

        return result;
    }
}
